shader MABTriangles(

    float Scale = 1,
    color Color1 = color(1,0,0), // red
    color Color2 = color(0,1,0), // green

    output color Color = 0 )
{
      point Vector = P;
  point p = Vector * Scale;

    // ignore the z component, this is a 2D pattern
    float y = p[1] / (sqrt(3)/2);
    float x = mod(p[0] - y/2, 1.0);
    y = mod(y,1.0);
    if( y > 1 - x ){
        Color = Color1;
    } else {
        Color = Color2;
    }
}